// pages/list/list.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		pg: 1,
		px: 0,
		http: getApp().globalData.map,
		pd: 1,
		xx: '',
		brand: 0,
		data:[],
		id:0
	},
	zonghe(){
		this.setData({
			px:0,
			data: [],
			pg:1,
			zt: false
		}) 
		this.push()
	},
	onShow() {
		this.setData({
			pg:1,
			data:[]
		})
		this.push()
	},
	push() {
		wx.request({
			url: getApp().globalData.http + 'action=newMxzcList&classID=' + this.data.id + '&key=&px=' + this.data.px +
				'&pg=' + this.data.pg,
			success: (e) => {
				console.log(e)
				let a = this.data.data
				for (let i in e.data.data.list) {
					a.push(e.data.data.list[i])
				}
				if (e.data.data.list.length < 15) {
					console.log(1)
					this.setData({
						pd: 0
					})
				}
				this.setData({
					data: a,
					list:e.data.data
				})
			}
		})
	},
	ovo() {
		if (this.data.pd == 1) {
			this.setData({
				pg: this.data.pg + 1
			})
			this.push()
		}
	},
	gb(e){
		this.setData({
			pg:1,
			data:[],
			id:e.currentTarget.dataset.id
		})
		this.push()
	},
	xl() {
		this.setData({
			px: 3,
			data: [],
			pg:1,
		})
		this.push()
	},
	jiage() {
		if (this.data.px == 2) {
			this.setData({
				px: 1,
				pg:1,
				data: []
			})
			this.push()
		} else {
			this.setData({
				px: 2,
				pg:1,
				data: []
			})
			this.push()
		}
	}
})
